home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / ge_cool.lha / GE_COOL2.1 / misc / defs / misc.h.old < prev   
Text File  |  1992-04-13  |  4KB  |  125 lines

  1. //
  2. //
  3. // Copyright (C) 1991 Texas Instruments Incorporated.
  4. //
  5. // Permission is granted to any individual or institution to use, copy, modify,
  6. // and distribute this software, provided that this complete copyright and
  7. // permission notice is maintained, intact, in all copies and supporting
  8. // documentation.
  9. //
  10. // Texas Instruments Incorporated provides this software "as is" without
  11. // express or implied warranty.
  12. //
  13. // This file  contains  useful definitions,  macros, and constants used through
  14. // out most header and source files.
  15. //
  16.  
  17. #ifndef MISCELANEOUSH                // If no miscelaneous header
  18. #define MISCELANEOUSH
  19.  
  20. #ifndef DEFSH
  21. #include <defs.h>                // Include the defs header
  22. #endif
  23.  
  24. /*
  25. #if (defined(MSDOS) && !defined(DOS))          // For IBM or MS compilers
  26. #define DOS
  27. #endif
  28. */
  29.  
  30. #ifndef INVALID                    // Define INVALID for curpos
  31. #define INVALID (-1)
  32. #endif
  33.  
  34. #ifndef END_OF_STRING                // If END_OF_STRING not defined
  35. #define END_OF_STRING (0)
  36. #endif
  37.  
  38. #ifndef NEWLINE                    // If Newline char not defined
  39. #define NEWLINE '\n'
  40. #endif
  41.  
  42. #ifndef SENSITIVE                // If case flags not defined
  43. #define SENSITIVE TRUE
  44. #define INSENSITIVE FALSE
  45. #endif
  46.  
  47. #ifndef BITSPERBYTE                // Machine bits per byte macros
  48. #define BITSPERBYTE 8
  49. #define BITS(type) (BITSPERBYTE * (int)sizeof(type))
  50. #define MINSHORT  ((short)(1 << BITS(short) - 1))
  51. #define MININT  (1 << BITS(int) - 1)
  52. #define MINLONG  (1L << BITS(long) - 1)
  53. #define MAXSHORT ((short)~MINSHORT)
  54. #define MAXINT  (~MININT)
  55. #define MAXLONG (~MINLONG)
  56. #endif
  57.  
  58. #ifndef NUMBER_STATES
  59. #define NUMBER_STATES
  60. enum N_status { N_OK, N_MINUS_INFINITY, N_PLUS_INFINITY, N_OVERFLOW,
  61.         N_UNDERFLOW, N_NO_CONVERSION, N_DIVIDE_BY_ZERO };
  62. #endif
  63.  
  64. /*
  65. #ifdef MAXDOUBLE
  66. #if (defined(pdp11) || defined(vax))                // Vaxen do it their own way...
  67. #define MAXDOUBLE    1.701411834604692293e+38
  68. #define MAXFLOAT    ((float)1.701411733192644299e+38)
  69.  The following is kludged because the PDP-11 compilers botch the simple form.
  70.    The kludge causes the constant to be computed at run-time on the PDP-11,
  71.    even though it is still "folded" at compile-time on the VAX. 
  72. #define MINDOUBLE    (0.01 * 2.938735877055718770e-37)
  73. #define MINFLOAT    ((float)MINDOUBLE)
  74. #define _IEEE        0
  75. #define _DEXPLEN    8
  76. #define _HIDDENBIT    1
  77. #define DMINEXP    (-DMAXEXP)
  78. #define FMINEXP    (-FMAXEXP)
  79. #else                        // IEEE floating point
  80. */
  81. #define MAXDOUBLE    1.79769313486231470e+308
  82. #define MAXFLOAT    ((float)3.40282346638528860e+38)
  83. #define MINDOUBLE    4.94065645841246544e-324
  84. #define MINFLOAT    ((float)1.40129846432481707e-45)
  85. #define    _IEEE        1
  86. #define _DEXPLEN    11
  87. #define _HIDDENBIT    1
  88. #define DMINEXP    (-(DMAXEXP + DSIGNIF - _HIDDENBIT - 3))
  89. #define FMINEXP    (-(FMAXEXP + FSIGNIF - _HIDDENBIT - 3))
  90. //#endif
  91. //#endif
  92.  
  93. #ifndef ABS
  94. #define ABS(x) ((x >= 0) ? (x) : (-x))
  95. #endif
  96.  
  97. // even --  Determine if long integer is odd of even
  98. // Input:   long integer
  99. // Output:  Boolean TRUE/FALSE
  100.  
  101. inline Boolean even (long n) {
  102.   return ((n & 1) ? FALSE : TRUE);
  103. }
  104.  
  105. // odd --  Determine if long integer is odd of even
  106. // Input:  long integer
  107. // Output: Boolean TRUE/FALSE
  108.  
  109. inline Boolean odd (long n) {
  110.   return ((n & 1) ? TRUE : FALSE);
  111. }
  112.  
  113. // The "#pragma defmacro" is a COOL extension to the standard  ANSI C processor
  114. // that allows  a programmer to  define macro  extensions to the  language. All
  115. // COOL  macros   have  been  incorporated  into  the preprocessor   itself  to
  116. // facilitate extra speed and efficiency. User defined  extensions are searched
  117. // for on the include file path.
  118.  
  119. #pragma defmacro MACRO "macro" delimiter=} recursive
  120. #pragma defmacro template "template" delimiter=}
  121. #pragma defmacro DECLARE "declare" delimiter=> recursive lines
  122. #pragma defmacro IMPLEMENT "implement" delimiter=> recursive lines
  123.  
  124. #endif MISCELANEOUSH                // End #ifdef
  125.